Ubuntu 16.04
Sponsored Link

HAProxy : Refer to the Statistics#2
2016/06/07
 
Configure HAProxy to see HAProxy's Statistics with commands.
[1] Install some packages.
root@dlp:~#
apt-get -y install socat
[2] Configure HAProxy.
root@dlp:~#
vi /etc/haproxy/haproxy.cfg
# add follows in the "global" section

global
      # binds UNIX sockets

    stats socket /var/lib/haproxy/stats

root@dlp:~#
systemctl restart haproxy

[3] Refer to the Statistics like follows.
# display current stats

root@dlp:~#
echo "show info" | socat /var/lib/haproxy/stats stdio
Name: HAProxy
Version: 1.6.3
Release_date: 2015/12/25
Nbproc: 1
Process_num: 1
Pid: 2043
...
...
Idle_pct: 100
node: dlp.srv.world
description:
# display stats with CSV

root@dlp:~#
echo "show stat" | socat /var/lib/haproxy/stats stdio
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,....
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,statu.....
http-in,FRONTEND,,,0,0,2000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,0,,,,0,0,0,0,0,0,,0,0,0,,,0,0.....
backend_servers,www01,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,0,51,0,,1,3,1,,0,,2,0,,0,L4OK,,0,0,0,0,0,.....
backend_servers,www02,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,0,51,0,,1,3,2,,0,,2,0,,0,L4OK,,0,0,0,0,0,.....
backend_servers,BACKEND,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,UP,2,2,0,,0,51,0,,1,3,0,,0,,1,0,,0,,,,0,0,0,0,.....
# display current session

root@dlp:~#
echo "show sess" | socat /var/lib/haproxy/stats stdio
0x1c06400: proto=unix_stream src=unix:1 fe=GLOBAL be=<NONE> srv=<none> ts=02 age=0s calls=1 rq[f=c08202h,
i=0,an=00h,rx=10s,wx=,ax=] rp[f=80008000h,i=0,an=00h,rx=,wx=,ax=] s0=[7,8h,fd=1,ex=] s1=[7,4018h,fd=-1,ex=] exp=10s
 
Tweet